package com.utility.hostnameverify;

import java.util.ArrayList;
import java.util.List;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;

/**
 * 可以拦截请求的域名是否符合条件
 */
public class OkHttpHostnameVerifier implements HostnameVerifier {
    private static List<String> list = new ArrayList<String>();
    static {
    	list.add("www.baidu.com");
    }
    @Override
    public boolean verify(String domain, SSLSession sslSession) {
        if(list.contains(domain)) {
            return true;
        }
        System.out.println("domain:" + domain);
        return false;
    }
}
